package a.f.l.a;

import a.c.ab;
import a.c.d;
import a.c.k;
import a.c.m;
import a.c.z;
import a.d.t;
import a.f.c.h;
import a.f.o;
import a.f.r;
import a.f.rc;
import a.f.tb;
import a.i.y;

import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class c
  extends r
{
  public static final byte g = 0;
  public static final byte h = 2;
  public static final byte i = 4;
  private static final a j = ;
  private static final double k = 1.0E-006D;
  private Object l = rc.d;
  private Object m = rc.c;
  private byte n;
  private double o = 10.0D;
  private double p = 0.5D;
  private double q = 50.0D;
  public static int r;
  
  public c(rc paramrc)
  {
    super(paramrc);
  }
  
  public c() {}
  
  private static a b()
  {
    a locala = new a();
    locala.a((byte)2);
    return locala;
  }
  
  public Object c()
  {
    return this.m;
  }
  
  public void a(Object paramObject)
  {
    if (paramObject == null) {
      throw new IllegalArgumentException("null");
    }
    this.m = paramObject;
  }
  
  public Object d()
  {
    return this.l;
  }
  
  public void b(Object paramObject)
  {
    if (paramObject == null) {
      throw new IllegalArgumentException("null");
    }
    this.l = paramObject;
  }
  
  public void a(byte paramByte)
  {
    if (!sb.e) {}
    switch (paramByte)
    {
    case 0: 
    case 2: 
    case 4: 
      this.n = paramByte;
      if (sb.d == 0) {
        break;
      }
    case 1: 
    case 3: 
    default: 
      throw new IllegalArgumentException("Argument '" + paramByte + "' not allowed.");
    }
  }
  
  public byte e()
  {
    return this.n;
  }
  
  public double f()
  {
    return this.o;
  }
  
  public void a(double paramDouble)
  {
    if (paramDouble < 0.0D) {
      throw new IllegalArgumentException("The distance must not be less than 0!");
    }
    this.o = paramDouble;
  }
  
  public double g()
  {
    return this.p;
  }
  
  public void b(double paramDouble)
  {
    if ((sb.e) || ((paramDouble < 0.0D) || (paramDouble > 0.5D))) {
      throw new IllegalArgumentException("The ratio must be between 0 and 0.5!");
    }
    this.p = paramDouble;
  }
  
  public double h()
  {
    return this.q;
  }
  
  public void c(double paramDouble)
  {
    if (paramDouble < 0.0D) {
      throw new IllegalArgumentException("The length must not be less than 0!");
    }
    this.q = paramDouble;
  }
  
  public boolean canLayout(o paramo)
  {
    return b(paramo);
  }
  
  public void doLayout(o paramo)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    a(paramo);
    ab localab = new ab();
    y localy = new y(paramo);
    Object localObject1 = paramo.w();
    label119:
    do
    {
      if (!((m)localObject1).e()) {
        break;
      }
      localObject2 = ((m)localObject1).a();
      if ((!bool) && (i1 != 0)) {
        break label146;
      }
      if (!bool) {
        if (!a.a((d)localObject2, paramo))
        {
          localy.a((d)localObject2);
          if (bool) {
            continue;
          }
          if (i1 == 0) {
            break label119;
          }
        }
      }
      if (!bool)
      {
        if (a((d)localObject2, paramo)) {
          localab.add(localObject2);
        }
        ((m)localObject1).f();
      }
    } while (i1 == 0);
    if (!bool) {
      j.c(f());
    }
    label146:
    localObject1 = new l();
    Object localObject2 = new a_((ib)localObject1, null);
    ((a_)localObject2).a(new x());
    ((a_)localObject2).a(new w());
    h localh = new h(paramo);
    qb localqb = new qb(paramo, localh, j);
    ((a_)localObject2).a(localqb);
    lc locallc = a(paramo, (s)localObject2, localqb);
    q localq = new q();
    localq.a(g());
    localq.b(h());
    localq.a(localab, locallc, localqb);
    ((a_)localObject2).c();
    a.f.hb localhb = new a.f.hb();
    localhb.doLayout(paramo);
    localh.e();
    localy.g();
    if (!bool)
    {
      if (a.c.q.n) {
        i1++;
      }
    }
    else {
      sb.d = i1;
    }
    if (a.c.q.o) {
      sb.e = !bool;
    }
  }
  
  private boolean a(d paramd, a.c.q paramq)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (e() == 0) {
        return true;
      }
    }
    k localk;
    if (!bool)
    {
      if (e() == 2)
      {
        localk = paramq.c(d());
        if ((bool) || (localk != null)) {
          if (bool) {}
        }
        return localk.getBool(paramd);
      }
      if (bool) {}
    }
    else if (e() == 4)
    {
      localk = paramq.c(c());
      if ((bool) || (localk != null)) {
        if (!bool) {
          if (!localk.getBool(paramd.e())) {
            if (bool) {
              break label139;
            }
          }
        }
      }
      label139:
      return localk.getBool(paramd.f());
    }
    return false;
  }
  
  private lc a(o paramo, s params, qb paramqb)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    lc locallc = new lc(paramqb);
    m localm = paramo.w();
    if (localm.e()) {}
    while (bool)
    {
      d locald = (d)localm.j();
      n localn = a(locald, paramo, params, paramqb);
      if (bool) {
        break label104;
      }
      locallc.a(locald, localn);
      localm.f();
      if (i1 != 0) {
        break label102;
      }
      if (i1 == 0) {
        break;
      }
    }
    a(paramo, locallc);
    label102:
    label104:
    return locallc;
  }
  
  private void a(o paramo, lc paramlc)
  {
    boolean bool = sb.e;
    int i2 = sb.d;
    HashMap localHashMap = new HashMap();
    Object localObject1 = paramo.w();
    Object localObject4;
    Object localObject5;
    Object localObject6;
    Object localObject7;
    label274:
    label282:
    do
    {
      do
      {
        if (!((m)localObject1).e()) {
          break;
        }
        localObject2 = paramlc.a(((m)localObject1).a());
        if (!bool)
        {
          if (localObject2 != null)
          {
            localObject3 = ((n)localObject2).k();
            localIterator = ((z)localObject3).iterator();
            localIterator.next();
            int i1 = 1;
            do
            {
              if (i1 >= ((n)localObject2).e()) {
                break label282;
              }
              if (i2 != 0) {
                break;
              }
              if (!localIterator.hasNext()) {
                break label282;
              }
              localObject4 = (a.d.w)localIterator.next();
              localObject5 = ((n)localObject2).a(i1);
              if (!bool) {
                if (localHashMap.containsKey(localObject4))
                {
                  localObject6 = (f)localHashMap.get(localObject4);
                  localObject7 = ((f)localObject6).l();
                  if (!bool) {
                    if (localObject7 == null)
                    {
                      z localz = new z();
                      localz.add(localObject6);
                      localz.add(localObject5);
                      localObject7 = new pc(((f)localObject6).c(), localz);
                      ((f)localObject6).a((pc)localObject7);
                      ((f)localObject5).a((pc)localObject7);
                      if (bool) {
                        continue;
                      }
                      if (i2 == 0) {
                        break label274;
                      }
                    }
                  }
                  ((pc)localObject7).b().add(localObject5);
                  ((f)localObject5).a((pc)localObject7);
                  if (bool) {
                    continue;
                  }
                  if (i2 == 0) {
                    break label274;
                  }
                }
              }
              localHashMap.put(localObject4, localObject5);
              i1++;
            } while (i2 == 0);
          }
          ((m)localObject1).f();
        }
      } while (bool);
    } while (i2 == 0);
    localObject1 = new z(localHashMap.keySet());
    ((z)localObject1).a(new Comparator()
    {
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        boolean bool = sb.e;
        a.d.w localw1 = (a.d.w)paramAnonymousObject1;
        a.d.w localw2 = (a.d.w)paramAnonymousObject2;
        if (!bool) {
          if (localw1.a() < localw2.a() - 1.0E-006D) {
            return -1;
          }
        }
        if (!bool) {
          if (localw1.a() > localw2.a() + 1.0E-006D) {
            return 1;
          }
        }
        if (!bool) {
          if (localw1.b() < localw2.b() - 1.0E-006D) {
            return -1;
          }
        }
        if (!bool) {
          if (localw1.b() > localw2.b() + 1.0E-006D) {
            return 1;
          }
        }
        return (int)(localw1.a() + localw1.b() - (localw2.a() + localw2.b()));
      }
    });
    Object localObject2 = null;
    Object localObject3 = null;
    Iterator localIterator = ((z)localObject1).iterator();
    label573:
    label703:
    label707:
    label709:
    do
    {
      if (!localIterator.hasNext()) {
        break;
      }
      a.d.w localw = (a.d.w)localIterator.next();
      if (((bool) || (localObject2 != null)) && ((bool) || ((Math.abs(((a.d.w)localObject2).a() - localw.a()) < 1.0E-006D) && (Math.abs(((a.d.w)localObject2).b() - localw.b()) < 1.0E-006D))))
      {
        if (!bool) {
          if (localObject3 != null)
          {
            localObject4 = (f)localHashMap.get(localw);
            if (!bool)
            {
              if (((f)localObject4).l() != null)
              {
                localObject5 = ((f)localObject4).l();
                localObject6 = ((pc)localObject5).b().iterator();
                do
                {
                  if (!((Iterator)localObject6).hasNext()) {
                    break;
                  }
                  localObject7 = (f)((Iterator)localObject6).next();
                  ((f)localObject7).a((pc)localObject3);
                  ((pc)localObject3).b().add(localObject7);
                  if (bool) {
                    break label709;
                  }
                  if (i2 != 0) {
                    break label707;
                  }
                } while (i2 == 0);
              }
              ((f)localObject4).a((pc)localObject3);
            }
            ((pc)localObject3).b().add(localObject4);
            if (bool) {
              break label573;
            }
            if (bool) {
              continue;
            }
            if (i2 == 0) {
              break label703;
            }
          }
        }
        localObject4 = (f)localHashMap.get(localObject2);
        localObject5 = (f)localHashMap.get(localw);
        if (!bool)
        {
          if (((f)localObject5).l() != null)
          {
            localObject3 = ((f)localObject5).l();
            ((pc)localObject3).b().add(localObject4);
            ((f)localObject4).a((pc)localObject3);
            if (!bool) {
              if (i2 == 0) {
                break label703;
              }
            }
          }
          else
          {
            localObject3 = new pc(((f)localObject4).c(), new z());
            ((pc)localObject3).b().add(localObject4);
          }
        }
        else
        {
          ((pc)localObject3).b().add(localObject5);
          ((f)localObject4).a((pc)localObject3);
          ((f)localObject5).a((pc)localObject3);
        }
        if (i2 == 0) {}
      }
      else
      {
        localObject3 = null;
      }
      localObject2 = localw;
    } while (i2 == 0);
  }
  
  private n a(d paramd, o paramo, s params, qb paramqb)
  {
    boolean bool = sb.e;
    int i3 = sb.d;
    if (a.b(paramd, paramo))
    {
      z localz = new z();
      a.d.n[] arrayOfn1 = a.c(paramd, paramo);
      if (!bool) {
        if (arrayOfn1.length == 0) {
          return null;
        }
      }
      int i1 = 0;
      Object localObject1;
      Object localObject2;
      label211:
      do
      {
        do
        {
          if (i1 >= arrayOfn1.length) {
            break;
          }
          mb localmb = null;
          localObject1 = arrayOfn1[i1];
          localObject2 = b((a.d.n)localObject1);
          do
          {
            if (localObject1 == null) {
              break label278;
            }
            localmb = a((a.d.n)localObject1, params, localmb);
            a.d.n[] arrayOfn2 = a((a.d.n)localObject1, localmb, (tb)localObject2);
            if (i3 != 0) {
              break;
            }
            double d;
            eb localeb;
            if (((a.d.n)localObject1).c())
            {
              d = ((a.d.n)localObject1).d().b();
              localeb = new eb(arrayOfn2[0].d().a(), arrayOfn2[0].e().a());
              if (bool) {
                break label211;
              }
              if (i3 == 0) {}
            }
            else
            {
              d = ((a.d.n)localObject1).d().a();
              localeb = new eb(arrayOfn2[0].d().b(), arrayOfn2[0].e().b());
            }
            if (!bool)
            {
              if (localeb.d() > 0.0D)
              {
                e locale = new e(paramd, i1, (tb)localObject2, new eb(d, d), localeb, localeb, localmb);
                locale.a(d);
                localz.add(locale);
              }
              localObject1 = arrayOfn2[1];
            }
          } while (i3 == 0);
          i1++;
        } while (bool);
      } while (i3 == 0);
      label278:
      n localn = new n(paramd, localz, paramqb);
      int i2 = 0;
      do
      {
        if (i2 >= localn.e()) {
          break;
        }
        if ((!bool) && (i3 != 0)) {
          break label365;
        }
        localObject1 = localn.a(i2);
        localObject2 = ((f)localObject1).b(0);
        ((f)localObject1).a(((e)localObject2).e());
        i2++;
      } while (i3 == 0);
      label365:
      return localn;
    }
    return null;
  }
  
  private mb a(a.d.n paramn, s params, mb parammb)
  {
    boolean bool = sb.e;
    int i1 = sb.d;
    double d3 = a(paramn);
    if (!bool) {
      if (d3 > 3.E-006D)
      {
        d1 = paramn.d().a() + (paramn.e().a() - paramn.d().a()) / d3 * 1.0E-006D * 2.0D;
        d2 = paramn.d().b() + (paramn.e().b() - paramn.d().b()) / d3 * 1.0E-006D * 2.0D;
        if (bool) {
          break label122;
        }
        if (i1 == 0) {
          break label131;
        }
      }
    }
    double d1 = paramn.e().a();
    label122:
    double d2 = paramn.e().b();
    label131:
    if ((bool) || (parammb != null))
    {
      localt1 = parammb.h();
      if (bool) {
        break label225;
      }
      if (t.a(localt1.d() - 1.0E-006D, localt1.e() - 1.0E-006D, localt1.b() + 2.0E-006D, localt1.c() + 2.0E-006D, d1, d2, true)) {
        return parammb;
      }
    }
    label225:
    t localt1 = new t(d1 - 1.0E-006D, d2 - 1.0E-006D, 2.0E-006D, 2.0E-006D);
    Object localObject;
    if (parammb == null)
    {
      localObject = params.a(localt1);
      if (bool) {
        break label397;
      }
      if (i1 == 0) {}
    }
    else
    {
      localObject = new z();
      List localList = params.c(parammb);
      Iterator localIterator = localList.iterator();
      do
      {
        mb localmb;
        t localt2;
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          localmb = (mb)localIterator.next();
          localt2 = localmb.h();
        } while (!t.a(localt2.d() - 1.0E-006D, localt2.e() - 1.0E-006D, localt2.b() + 2.0E-006D, localt2.c() + 2.0E-006D, d1, d2, true));
        if (bool) {
          break label410;
        }
        ((List)localObject).add(localmb);
        if (bool) {
          break label397;
        }
        if (i1 != 0) {
          break label402;
        }
        if (bool) {
          break label397;
        }
      } while (i1 == 0);
    }
    if (!bool) {
      if (((List)localObject).isEmpty()) {
        label397:
        return null;
      }
    }
    label402:
    label410:
    return (mb)((List)localObject).get(0);
  }
  
  private double a(a.d.n paramn)
  {
    boolean bool = sb.e;
    if (!bool)
    {
      if (paramn.c()) {
        return Math.abs(paramn.d().a() - paramn.e().a());
      }
      if (bool) {}
    }
    else if (paramn.b())
    {
      return Math.abs(paramn.d().b() - paramn.e().b());
    }
    return paramn.h();
  }
  
  private static tb b(a.d.n paramn)
  {
    boolean bool = sb.e;
    a.d.w localw1 = paramn.d();
    a.d.w localw2 = paramn.e();
    if (!bool) {
      if (localw1.a() < localw2.a())
      {
        if (bool) {
          break label66;
        }
        if (Math.abs(localw1.b() - localw2.b()) < 1.0E-006D) {
          return tb.b;
        }
      }
    }
    label66:
    if (!bool) {
      if (localw1.b() < localw2.b())
      {
        if (bool) {
          break label109;
        }
        if (Math.abs(localw1.a() - localw2.a()) < 1.0E-006D) {
          return tb.c;
        }
      }
    }
    label109:
    if (!bool) {
      if (localw2.a() < localw1.a())
      {
        if (bool) {
          break label152;
        }
        if (Math.abs(localw1.b() - localw2.b()) < 1.0E-006D) {
          return tb.d;
        }
      }
    }
    label152:
    if ((bool) || ((localw2.b() < localw1.b()) && (Math.abs(localw1.a() - localw2.a()) < 1.0E-006D))) {
      return tb.a;
    }
    throw new IllegalArgumentException("Segment isn't orthogonal");
  }
  
  private a.d.n[] a(a.d.n paramn, mb parammb, tb paramtb)
  {
    boolean bool = sb.e;
    t localt = parammb.h();
    a.d.w localw1 = paramn.d();
    a.d.w localw2 = paramn.e();
    double d3 = a(paramn);
    if (!bool) {
      if (d3 > 3.E-006D)
      {
        d1 = localw1.a() + (localw2.a() - localw1.a()) / d3 * 1.0E-006D * 2.0D;
        d2 = localw1.b() + (localw2.b() - localw1.b()) / d3 * 1.0E-006D * 2.0D;
        if (bool) {
          break label122;
        }
        if (sb.d == 0) {
          break label129;
        }
      }
    }
    double d1 = localw2.a();
    label122:
    double d2 = localw2.b();
    label129:
    double d4 = localt.d();
    double d5 = localt.b();
    double d6 = localt.e();
    double d7 = localt.c();
    if (!bool) {
      if (!t.a(d4 - 1.0E-006D, d6 - 1.0E-006D, d5 + 2.0E-006D, d7 + 2.0E-006D, d1, d2, true)) {
        throw new IllegalArgumentException("LineSegment doesn't start in passed cell");
      }
    }
    if (((!bool) && ((paramtb.d()) && ((!bool) && (a(d4, d4 + d5, localw2.a()))))) || (((bool) || (!paramtb.d())) && ((bool) || (a(d6, d6 + d7, localw2.b()))))) {
      return new a.d.n[] { paramn, null };
    }
    a.d.w localw3 = null;
    if (!bool) {
      if (tb.b.equals(paramtb))
      {
        localw3 = new a.d.w(parammb.k(), localw1.b());
        break label414;
      }
    }
    if (!bool) {
      if (tb.d.equals(paramtb))
      {
        localw3 = new a.d.w(parammb.i(), localw1.b());
        break label414;
      }
    }
    if (tb.c.equals(paramtb)) {
      localw3 = new a.d.w(localw1.a(), parammb.l());
    } else {
      localw3 = new a.d.w(localw1.a(), parammb.j());
    }
    label414:
    return new a.d.n[] { new a.d.n(localw1, localw3), new a.d.n(localw3, localw2) };
  }
  
  private static boolean a(double paramDouble1, double paramDouble2, double paramDouble3)
  {
    boolean bool = sb.e;
    if ((bool) || (paramDouble3 + 1.0E-006D >= paramDouble1)) {
      if (bool) {}
    }
    return paramDouble3 - 1.0E-006D <= paramDouble2;
  }
  
  private static class a_
    extends s
  {
    private a_(ib paramib)
    {
      super();
    }
    
    t a(o paramo, List paramList)
    {
      int i = sb.d;
      Rectangle localRectangle = paramo.d();
      Iterator localIterator = paramList.iterator();
      do
      {
        if (!localIterator.hasNext()) {
          break;
        }
        hb localhb = (hb)localIterator.next();
        if (i != 0) {
          break label132;
        }
        t localt = localhb.a();
        Rectangle2D.Double localDouble = new Rectangle2D.Double(localt.d(), localt.e(), localt.b(), localt.c());
        Rectangle2D.union(localRectangle, localDouble, localRectangle);
      } while (i == 0);
      label132:
      return new t(localRectangle.getX() - 100.0D, localRectangle.getY() - 100.0D, localRectangle.getWidth() + 200.0D, localRectangle.getHeight() + 200.0D);
    }
    
    a_(ib paramib, c.1 param1)
    {
      this(paramib);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.a.c

 * JD-Core Version:    0.7.0.1

 */